/*
 * Test to Liver.java
 * 15.06.2012
 */

package human;

import static org.junit.Assert.*;
import human.Liver;
import human.Organ;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests to Liver.java
 * 
 * @author Vasyl Khyzhniak
 * @version 1.2
 */
public class LiverTest {

	Liver liverTest;

	@Before
	public void setUp() {
		liverTest = new Liver();
	}

	@Test
	public void shouldBeCorrectHealthWhenLiverCreated() {
		// given

		// when

		// then
		assertEquals(0, liverTest.getHealth());
	}

	@Test
	public void shouldBeCorrectCholesterolWhenLiverCreated() {
		// given

		// when

		// then
		assertEquals(0, liverTest.getCholesterol());
	}

	@Test
	public void shouldBeCorrectDetoxificationWhenLiverCreated() {
		// given

		// when

		// then
		assertEquals(0, liverTest.getDetoxification());
	}

	@Test
	public void shouldBeCorrectGlucoseWhenLiverCreated() {
		// given

		// when

		// then
		assertEquals(0, liverTest.getGlucose());
	}

	@Test
	public void shouldBeNecessaryForLifeWhenLiverCreated() {
		// given

		// when

		// then
		assertEquals(true, liverTest.getLifeImportance());
	}

	@Test
	public void shouldBeModifiedCholesterolWhenChanging() {
		// given

		// when
		liverTest.changeCholesterol(15);
		// then
		assertEquals(15, liverTest.getCholesterol());
	}

	@Test
	public void shouldBeModifiedDetoxificationWhenChanging() {
		// given

		// when
		liverTest.changeDetoxification(15);
		// then
		assertEquals(15, liverTest.getDetoxification());
	}

	@Test
	public void shouldBeModifiedGlucoseWhenChanging() {
		// given

		// when
		liverTest.changeGlucose(15);
		// then
		assertEquals(15, liverTest.getGlucose());
	}

	@Test
	public void shouldBeModifiedHealthWhenChanging() {
		// given

		// when
		liverTest.changeHealth(15);
		// then
		assertEquals(15, liverTest.getHealth());
	}

	@Test
	public void shouldControlLowerLimitWhenHealthModified() {
		// given

		// when
		liverTest.changeHealth(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, liverTest.getHealth());
	}

	@Test
	public void shouldControlLowerLimitWhenCholesterolModified() {
		// given

		// when
		liverTest.changeCholesterol(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, liverTest.getCholesterol());
	}

	@Test
	public void shouldControlLowerLimitWhenDetoxificationModified() {
		// given

		// when
		liverTest.changeDetoxification(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, liverTest.getDetoxification());
	}

	@Test
	public void shouldControlLowerLimitWhenGlucoseModified() {
		// given

		// when
		liverTest.changeGlucose(Organ.LOWER_LIMIT - 10);
		// then
		assertEquals(Organ.LOWER_LIMIT, liverTest.getGlucose());
	}

	@Test
	public void shouldControlUpperLimitWhenHealthModified() {
		// given

		// when
		liverTest.changeHealth(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, liverTest.getHealth());
	}

	@Test
	public void shouldControlUpperLimitWhenCholesterolModified() {
		// given

		// when
		liverTest.changeCholesterol(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, liverTest.getCholesterol());
	}

	@Test
	public void shouldControlUpperLimitWhenDetoxificationModified() {
		// given

		// when
		liverTest.changeDetoxification(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, liverTest.getDetoxification());
	}

	@Test
	public void shouldControlUpperLimitWhenGlucoseModified() {
		// given

		// when
		liverTest.changeGlucose(Organ.UPPER_LIMIT + 10);
		// then
		assertEquals(Organ.UPPER_LIMIT, liverTest.getGlucose());
	}
}
